Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved handling of multidoc insertion errors for vector store #110

Merged
merged 6 commits into from
Feb 4, 2025

Conversation

hemidactylus
Copy link
Collaborator

@hemidactylus hemidactylus commented Jan 31, 2025

This PR alleviates a problem with the kind of error that is raised under different failure scenarios during AstraDBVectorStore insertions.

(Do not mind the CI failing. There is some bug with the CI actions related to secrets not trickling down to the test workflows. I ran the tests locally and everything related went smooth.) <== Nevermind, those CI problems somehow have vanished (by themselves?).

Current problems:

the insertion is attempted assuming new document _ids. If it fails, the (detailed) errors from astrapy are inspected.
(note: "errors", plural, since a single insertion can result in a number of errors from several documents).

  1. If they are all of type "id already exists", then the flow switches to running a bunch of find-one-and-update and everything works
  2. if there are (also) other errors from the Data API, an exception is surfaced to the user.

Now, this exception right now is the one received from Astrapy, a fact which has two flaws:

  • It includes the "doc already exists" bits (that the V.Store in reality could handle if they were the only problem)
  • Its string representation, in astrapy 1.x, just lists the first of the possibly many errors. (this is fixed in astrapy 2.0 but that's another story)

These 2 issues can combine leading to a scenario where all the user sees is a "doc already exists", adding to the confusion.

Also it can be argued that it is leaky, in this case, to expose an astrapy exception as is to the user.

What this PR does

The change is for case 2 above.

  • Now a ValueError newly-introduced langchain_astradb.AstraDBVectorStoreError is raised (and not a astrapy.exception.InsertManyException anymore - slightly breaking for try-catch code)
  • The text message of this error is a concatenation of all errors from the Data API triggered by the insertion, with the "already exists" filtered out. _In case there are too many, a max amount is shown with a "there is more" notice.
  • The original astrapy exception is always chained, so if users want to dig deeper they can inspect the error's __cause__. A note in the very error messages reminds the user about this (see examples below).

Below is a Python script exemplifying various insertion scenarios and the before- and after- kind of exception a user would get.

Demo script (before-and-after)

"""
This script demonstrates the changes this PR brings to the insertion exception logic.

The vectorstore starts empty and then runs 5 add_documents calls, with
new-id and preexisting-id, with faulty documents thrown in, as shown in the diagram
a few lines below.

For the relevant insertions, the class and message of the exception
is given in comments in this code.

I think this change fixes the shortcomings about
truncated/irrelevant error messages.

A question remains: shall the all-error description be given an upper limit to the number
of errors it concatenates (20 or so) ? It could become a *really* long string otherwise
(and if the insertion fails 20+ times, there's probably little point in notifying the user
about all of them...)
"""

import json
import os

from langchain_core.documents import Document
from langchain_core.embeddings import Embeddings

from langchain_astradb import AstraDBVectorStore


class ParserEmbeddings(Embeddings):
    """Parse input texts: if they are json for a List[float], fine.
    Otherwise, return all zeros and call it a day.
    """

    def __init__(self, dimension: int) -> None:
        self.dimension = dimension

    def embed_documents(self, texts: list[str]) -> list[list[float]]:
        return [self.embed_query(txt) for txt in texts]

    async def aembed_documents(self, texts: list[str]) -> list[list[float]]:
        return self.embed_documents(texts)

    def embed_query(self, text: str) -> list[float]:
        try:
            vals = json.loads(text)
        except json.JSONDecodeError:
            return [0.0] * self.dimension
        else:
            assert len(vals) == self.dimension
            return vals

    async def aembed_query(self, text: str) -> list[float]:
        return self.embed_query(text)


"""
Insertion rounds, plan:

_id    A     B     C     D     E
 00    I     .     .     .     .
 01    I     .     .     .     .
 02    I     .     .     .     .
 03    I     .     .     .     .
 04    I     .     .     .     .
 05    I     O     .     .     .
 06    I     O     .     .     .
 07    I     O     .     .     .
 08    I     O     .     .     .
 09    I     O     .     .     .
 10    .     I     .     .     .
 11    .     I     .     .     .
 12    .     I     .     .     .
 13    .     I     .     .     .
 14    .     I     O     .     .
 15    .     .     F     .     .
 16    .     .     I     .     .
 17    .     .     I     .     .
 18    .     .     I     .     .
 19    .     .     I     .     .
 20    .     .     I     F     .
 21    .     .     I     F     .
 22    .     .     I     .     F
 23    .     .     I     .     .
 24    .     .     I     .     .

    I = insert
    O = overwrite (insert on preexisting ID)
    F = faulty doc supplied
"""

if __name__ == "__main__":
    embe = ParserEmbeddings(2)

    vstore = AstraDBVectorStore(
        collection_name="errmessages",
        embedding=embe,
        token=os.environ["ASTRA_DB_APPLICATION_TOKEN"],
        api_endpoint=os.environ["ASTRA_DB_API_ENDPOINT"],
        batch_size=5,
    )
    vstore.clear()

    # A: insertion ok
    vstore.add_documents(
        [
            Document(
                page_content=f"[1,{di}]", metadata={"a": di, "gen": "A"}, id=f"{di:02}"
            )
            for di in range(10)
        ]
    )

    # B: insertion with dupes
    vstore.add_documents(
        [
            Document(
                page_content=f"[1,{di}]", metadata={"a": di, "gen": "B"}, id=f"{di:02}"
            )
            for di in range(5, 15)
        ]
    )

    # C: insertion with mixed errors
    try:
        vstore.add_documents(
            [
                # a puny overwrite
                Document(
                    page_content="[1,14]", metadata={"a": 14, "gen": "C"}, id="14"
                ),
            ]
            + [
                # new ones - but with a faulty doc in the middle
                Document(
                    page_content="[1,15]", metadata={"a": 15, "gen": "C"}, id="15"
                ),
                Document(
                    page_content="[1,16]",
                    metadata={"a": 16, "gen": "C", "$trouble?": "yes"},
                    id="16",
                ),
            ]
            + [
                Document(
                    page_content=f"[1,{di}]",
                    metadata={"a": di, "gen": "C"},
                    id=f"{di:02}",
                )
                for di in range(17, 25)
            ]
        )
    except Exception as err:
        print("\nC => ERROR")
        print(f"    str(err):  {str(err)}")
        print(f"    type(err): {type(err)}")
        print(f"    err:       {err}")
        print(f"    C.ERRDSC:  {err.__cause__.error_descriptors}")

    """
    Current output is incomplete and misleading.
    (the mentioned _id does not get overwritten in the collection, but the faulty one is not reported!)

        C => ERROR
            str(err):  Failed to insert document with _id 14: Document already exists with the given _id
            type(err): <class 'astrapy.exceptions.InsertManyException'>
            err:       Failed to insert document with _id 14: Document already exists with the given _id

    This PR:

        C => ERROR
            str(err):  Cannot insert documents. The Data API returned the following error(s): Failed to insert document with _id 16: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-) (Full API error in '<this-exception>.__cause__.error_descriptors': ignore 'DOCUMENT_ALREADY_EXISTS'.)
            type(err): <class 'langchain_astradb.vectorstores.AstraDBVectorStoreError'>
            err:       Cannot insert documents. The Data API returned the following error(s): Failed to insert document with _id 16: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-) (Full API error in '<this-exception>.__cause__.error_descriptors': ignore 'DOCUMENT_ALREADY_EXISTS'.)
            C.ERRDSC:  [DataAPIErrorDescriptor('Document already exists with the given _id', error_code='DOCUMENT_ALREADY_EXISTS', message='Failed to insert document with _id 14: Document already exists with the given _id', family='REQUEST', scope='DOCUMENT', id='34761ccd-8d6d-45fd-801a-bcad74bcc201'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 16: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='a893ec7f-8eb0-4c3d-a26c-d558e7ff9128')]
    """

    # D: insertion with only errors
    try:
        vstore.add_documents(
            [
                Document(
                    page_content="[1,20]",
                    metadata={"a": 20, "gen": "D", "$trouble?": "yes"},
                    id="20",
                ),
                Document(
                    page_content="[1,21]",
                    metadata={"a": 21, "gen": "D", "superlist": list(range(1001))},
                    id="21",
                ),
            ]
            + [
                Document(
                    page_content=f"[1,{i}]",
                    metadata={"a": i, "gen": "D", "$trouble?": "yes"},
                    id=f"{i:02}",
                )
                for i in range(50, 60)
            ]
        )
    except Exception as err:
        print("\nD => ERROR")
        print(f"    str(err):  {str(err)}")
        print(f"    type(err): {type(err)}")
        print(f"    err:       {err}")
        print(f"    C.ERRDSC:  {err.__cause__.error_descriptors}")
    """
    Current output is incomplete: only the first error is mentioned.

        D => ERROR
            str(err):  Failed to insert document with _id 20: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)
            type(err): <class 'astrapy.exceptions.InsertManyException'>
            err:       Failed to insert document with _id 20: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)

    This PR:

        D => ERROR
            str(err):  Cannot insert documents. The Data API returned the following error(s): Failed to insert document with _id 20: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 21: Document size limitation violated: number of elements an indexable Array (property 'superlist') has (1001) exceeds maximum allowed (1000); Failed to insert document with _id 50: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 51: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 52: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 53: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 54: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 55: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-). (Note: 4 further errors omitted.) (Full API error in '<this-exception>.__cause__.error_descriptors': ignore 'DOCUMENT_ALREADY_EXISTS'.)
            type(err): <class 'langchain_astradb.vectorstores.AstraDBVectorStoreError'>
            err:       Cannot insert documents. The Data API returned the following error(s): Failed to insert document with _id 20: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 21: Document size limitation violated: number of elements an indexable Array (property 'superlist') has (1001) exceeds maximum allowed (1000); Failed to insert document with _id 50: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 51: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 52: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 53: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 54: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-); Failed to insert document with _id 55: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-). (Note: 4 further errors omitted.) (Full API error in '<this-exception>.__cause__.error_descriptors': ignore 'DOCUMENT_ALREADY_EXISTS'.)
            C.ERRDSC:  [DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 20: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='6bc3df55-7fb7-448d-ac48-b351715ffbdf'), DataAPIErrorDescriptor('Document size limitation violated', error_code='SHRED_DOC_LIMIT_VIOLATION', message="Failed to insert document with _id 21: Document size limitation violated: number of elements an indexable Array (property 'superlist') has (1001) exceeds maximum allowed (1000)", family='REQUEST', scope='DOCUMENT', id='ba8aa416-262c-4fe9-b6a5-19c912c4f9f5'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 50: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='58aa4d9b-ae65-4b29-be69-a6d546f9b2e4'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 51: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='f4b323b2-9189-4a5e-9122-3d0e7925fcd9'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 52: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='891159be-0e6f-4e0b-9770-3546565f5321'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 53: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='1c399a2c-9193-4b8f-a14c-b4d32a5e67f6'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 54: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='21921de2-f710-4d0a-ac1a-2f35456397b6'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 55: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='033b981f-2649-4464-95df-152e169cbe76'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 56: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='a4372af9-0170-41d7-a4bc-10ddd9a1139d'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 57: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='5775d759-43f3-4ef1-ad24-68dfee39ad11'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 58: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='c0825e68-84fe-4fd5-b562-62e8dc07e192'), DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Failed to insert document with _id 59: Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='c7af12d7-27c4-4ece-92f8-825983d2a43b')]
    """

    # E: *single* insertion with an error
    try:
        vstore.add_documents(
            [
                Document(
                    page_content="[1,22]",
                    metadata={"a": 22, "gen": "D", "$trouble?": "yes"},
                    id="22",
                ),
            ]
        )
    except Exception as err:
        print("\nE => ERROR")
        print(f"    str(err):  {str(err)}")
        print(f"    type(err): {type(err)}")
        print(f"    err:       {err}")
        print(f"    C.ERRDSC:  {err.__cause__.error_descriptors}")
    """
    Current output is lacking the 'failed to insert document with id' preamble:

        E => ERROR
            str(err):  Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)
            type(err): <class 'astrapy.exceptions.InsertManyException'>
            err:       Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)

    **NOTE**: The lack of _id in this case is a Data API behaviour (filed an issue: https://github.com/stargate/data-api/issues/1840). Should not ever be a real problem in this context.

    This PR:

        E => ERROR
            str(err):  Cannot insert documents. The Data API returned the following error(s): Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-) (Full API error in '<this-exception>.__cause__.error_descriptors': ignore 'DOCUMENT_ALREADY_EXISTS'.)
            type(err): <class 'langchain_astradb.vectorstores.AstraDBVectorStoreError'>
            err:       Cannot insert documents. The Data API returned the following error(s): Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-) (Full API error in '<this-exception>.__cause__.error_descriptors': ignore 'DOCUMENT_ALREADY_EXISTS'.)
            C.ERRDSC:  [DataAPIErrorDescriptor('Document field name invalid', error_code='SHRED_DOC_KEY_NAME_VIOLATION', message="Document field name invalid: field name ('$trouble?') contains invalid character(s), can contain only letters (a-z/A-Z), numbers (0-9), underscores (_), and hyphens (-)", family='REQUEST', scope='DOCUMENT', id='8685b9ae-c5f3-445c-9c7d-5fea3ab4f6fd')]
    """

@hemidactylus hemidactylus requested a review from cbornet January 31, 2025 16:03
@hemidactylus
Copy link
Collaborator Author

Huh? The integration tests are able to run again? Well that's definitely good news (though I wonder what was the cause for the secrets not passing through in the first place).

@hemidactylus hemidactylus marked this pull request as draft January 31, 2025 17:18
@hemidactylus
Copy link
Collaborator Author

Added a cap (currently 8) on the amount of errors ending up in the message string.
Now it may end (if necessary) with something like:

[...] (Note: 4 further errors omitted.)

@hemidactylus
Copy link
Collaborator Author

Added a note in the error message on the original astrapy exception being accessible by chaining as __cause__ (exemplified in the example script above in this PR).

@hemidactylus hemidactylus marked this pull request as ready for review February 2, 2025 22:38
f"following error(s): {all_err_descs}"
f"{there_s_more}{original_err_note}"
)
raise ValueError(full_err_message) from err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValueError should normally be for errors on the input args.
Maybe there could be a AstraDBVectorStoreError ?
(there are a few other places that could be replaced)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I would consider not creating custom stuff unless really necessary, but yours might be a good suggestion. Would you rather:

  • raise a RuntimeError (more appropriate than ValueError, I agree)
  • create an AstraDBVectorStoreError, subclass of RuntimeError ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think good practice would be to specialize the exception, so use AstraDBVectorStoreError.
AstraDBVectorStoreError can be subclass of Exception, not necessarily RuntimeError.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented AstraDBVectorStoreError and now it is raised in methods of AstraDBVectorStore that are not happening as part of the init (in a broad sense, e.g. autodetection errors are still "during init" => ValueError)

for edesc in filtered_error_descs[:MAX_SHOWN_INSERTION_ERRORS]
)
there_s_more: str
if len(filtered_error_descs) > MAX_SHOWN_INSERTION_ERRORS:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:

if num_residual := len(filtered_error_descs) - MAX_SHOWN_INSERTION_ERRORS:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To walrus up the assignment correctly, it must actually be

if num_residual := max(0, len(filtered_error_descs) - MAX_SHOWN_INSERTION_ERRORS):

Slightly less readable but still OK i guess. (otherwise you get funny "Note: -7 errors omitted" or similar)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you're right.
I think then keep it as-is, without max.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no sorry again !
It could be

if num_residual := len(filtered_error_descs) - MAX_SHOWN_INSERTION_ERRORS > 0:

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahah, you are right! Silly me for not having thought of that myself. One moment ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um... wrong again? For the variable would be a boolean, but what is needed for the message is a number.
I think I will leave it as is, with apologies for the missed walrus.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silly me

if (num_residual := len(filtered_error_descs) - MAX_SHOWN_INSERTION_ERRORS) > 0:

This time it should work, I tested 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eheh, I pushed this one and I agree this is our man! Tests running again

@hemidactylus hemidactylus merged commit 06c73f0 into main Feb 4, 2025
13 checks passed
@hemidactylus hemidactylus deleted the SL-vs-insertmany-errors branch February 4, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants